package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.Address;
import cn.wolfcode.trip.base.domain.Cart;
import cn.wolfcode.trip.base.domain.PointMsg;
import cn.wolfcode.trip.base.service.IAddressService;
import cn.wolfcode.trip.base.service.ICartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/addresses")
public class AddressController {

    @Autowired
    private IAddressService addressService;

    /*
        查找指定的地址信息
        资源: /addresses/{id}
        动作: GET
        参数
     */
    @GetMapping("/{id}")
    public Object getAddress(@PathVariable Long id){
        return addressService.getAddress(id);
    }

    /*
        查找指定的地址信息测试
        资源: /addresses
        动作: POST
        参数
     */
    @PostMapping
    public void save(Address address){
        addressService.save(address);
    }

    /*
        查找指定的地址信息
        资源: /addresses
        动作: PUT
        参数
     */
    @PutMapping
    public void update(Address address){
        addressService.update(address);
    }

}
